﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OrderList.aspx.cs" Inherits="Com.CMS263.Web.manage.ManageOrder.OrderList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
     <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <link href="../common/validator.css" rel="stylesheet" type="text/css" />
    <script language="javascript" src="../../js/jquery-1.3.2.min.js"></script>
    <script src="../js/pager.js" type="text/javascript"></script>
    <script language ="javascript" type ="text/javascript" >
        $(function() {
            $("#chkAll").click(function() {
                $("input[name='chek']").attr("checked", $(this).attr("checked"))
            })
        })

        function check() {
            $("#chkAll").attr("checked", "");
        }
        
        function GetBatch(txt, routes) {
            var IDArray = "";
            var Flag = false
            if (confirm(txt)) {
                var val = $('#tab [name=chek]:checked');
                for (var i = 0; i < val.length; i++) {
                    if (val[i].checked) {
                        IDArray += val[i].value;
                        if ((i) == val.length - 1)
                        { IDArray += ""; }
                        else
                        { IDArray += ","; }
                        Flag = true;
                    }
                }
                if (Flag) {
                    $("#form1").attr("action", routes);
                    $("#form1").submit();
                } else { alert("[未选择任何数据,指令被取消]"); }

            }
        }
        function del(id, obj) {
            if (confirm('确认删除此条记录')) {
                $.post("OrderDel.ashx", { id: id }, function(data) {
                    if (data == "ok") {
                        alert('删除成功');
                        $(obj.parentNode.parentNode).remove();
                    }
                })
            }
        }
        $(function() {
            $("#tab tr").mouseover(function() {
                $("#tab tr").attr("className", "asd02")
                $(this).attr("className", "asd01")
            })
        })
        
       </script>
</head>
<body>
    <form id="form1" runat="server" action =""  method="post" enctype="multipart/form-data" >
     <div>
    <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_1">
                <tr>
                    <td height="23" class="table_2">
                       <span id="lbTypeName">常见问题</span>  管理</td>
                </tr>
                <tr>
                    
                    <td class="tdside" align="left">
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                        搜索:<input name="txtKey" type="text" id="txtKey" />
                        <asp:Button ID="Button1" runat="server" Text="搜索"  onclick="Button1_Click" />
                        <%--<input id="Button3" type="button" value="搜索" onclick ="javascript:window.location.href='/manage/ManageOrder/OrderList.aspx?xiugai=2'"/>--%>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <span >排列方式</span>
                           <select name="sort" id="sort">
                              <option value ="0">时间倒序排列</option>
                              <option value ="1">时间正序排列</option>
                              <option value ="2">价钱从高到底</option>
                              <option value ="3">价钱从低到高</option>
                            </select><asp:Button ID="Button2" runat="server" Text="排序" 
                            onclick="Button2_Click" />
                        <br />
                    </td>
                </tr>
                <tr><td>
                
                <table width="100%" id="tab">
                 <tr style="text-align:center">
                 <td>  <input name="chkbox" type="checkbox" id="chkAll" /></td>
                 <td>订单编号</td>
                 <td>用户</td> 
                 <td>总价</td>
                 <td>时间</td>
                 <td>状态</td>
                 <td>操作</td>
                 </tr>
                <%foreach (Com.CMS263.PO.DealInfo deal in deallist) %>
                <%{ %>
                
                
                <tr  id="<%=deal.Id %>" style ="text-align:center" >
                <td><input id="chek<%=deal.Id %>" type="checkbox" value ="<%=deal.Id %>" name ="chek"  onclick ="check()" /></td>
                <td><%=deal .OrderId%></td>
                <td><%=deal .UserName%></td>
                     <td>￥<%=deal .TotalPrice .ToString () %></td>
                <td><%=deal.AddDate .ToShortDateString () %></td>
                <%if (deal.State == 1) %>
                <%{ %>
                <td>审核订单</td>
                <%} %>
                 <%if (deal.State == 2) %>
                <%{ %>
                <td>确认订单</td>
                <%} %>
                 <%if (deal.State == 3) %>
                <%{ %>
                <td>发货</td>
                <%} %>
                 <%if (deal.State == 4) %>
                <%{ %>
                <td>收货</td>
                <%} %>
                 <%if (deal.State == 5) %>
                <%{ %>
                <td>回款</td>
                <%} %>
                 <%if (deal.State == 6) %>
                <%{ %>
                <td>退货</td>
                <%} %>
                 <%if (deal.State == 7) %>
                <%{ %>
                <td>取消订单</td>
                <%} %>
                <%if (deal.State == 8) %>
                <%{ %>
                <td>订单结束</td>
                <%} %>
              
                
                <td>
                <input type="button" class="btn4_out" onmouseover="this.className='btn4_over'" onmouseout="this.className='btn4_out'" onclick="del(<%=deal.Id%>,this)" value="删除" />
                    <input type="button" class="btn4_out" onmouseover="this.className='btn4_over'" onmouseout="this.className='btn4_out'" onclick="javascript:window.location.href='OrderShow.aspx?id=<%=deal.Id%>'" value="编辑" />
                
                   </td>
                </tr>
               
            <%} %>
              
             
               
                </table>
                
                <tr>
                   
                <td class="tdside" >
                <div style="float: left; margin: 20px 0; padding-left: 20px;">
                        <span style="color: Red;">批量操作 </span><span >请选择操作项</span>
                        <select name="select1" id="select1">
                              <option value ="1">审核订单</option>
                              <option value ="2">确认订单</option>
                              <option value ="3">取消订单</option>
                               <option value ="4">发货</option>
                              <option value ="5">收货</option>
                              <option value ="6">回款</option>
                              <option value ="7">退货</option>
                               <option value ="8">订单结束</option>
                              <option value ="0">删除</option>
                            </select> 
                        <a href="javascript:GetBatch('你确定要批量操作吗?','/manage/ManageOrder/OrderList.aspx?xiugai=1');"
                            style="cursor: pointer">修改</a> 
                            
                            </div><br />
                <div align="right">
             <%=GetPager () %>
                </div>
                </tr>
             
                
                </table>
    </div>
    </form>
</body>
</html>
